const vscode = require('vscode');

class Cmd {
    constructor (command, callback) {
        this.hasReg = false;
        this.command = command;
        this.callback = callback;
    }

    execute () {
        this.callback();
    }

    register (context) {
        if (!this.hasReg) {
            context.subscriptions.push(vscode.commands.registerCommand(this.command, this.callback));
            this.hasReg = true;
        }
    }
}

module.exports = {
    Cmd
};
